/****************************************Copyright (c)****************************************************
**     
** File name:               humi.c
** Created by:              XiaoYi
** Created date:            2020-10-16
** Version:                 v1.0
** Descriptions:            The original 
** Link address:            https://blog.csdn.net/weixin_45006076
**
*********************************************************************************************************/

#include "key_scan.h"

/*******************************************************************************
* @brief  : key_scan
* Description    : scan key's status
* Input          : None
* Output         : None
* Return         : Return the clicked button
* Attention		 : None
*******************************************************************************/

int key_scan(void)
{	 

	if(KEY1 == 0 ||KEY2==0||KEY3==0)
	{
		delay_ms(10);
		if(KEY1 == 0){
			// wait key1 released
			while(!KEY1);
			return KEY1_PRES; 
		}
		if(KEY2 == 0){
			// wait key2 released
			while(!KEY2);
			return KEY2_PRES; 
		}
		if(KEY3 == 0){
			// wait key3 released
			while(!KEY3);
			return KEY3_PRES; 
		}
	}

 	return 0;
}
